﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Roslyn.Compilers;
using Roslyn.Compilers.Compilation;
using Roslyn.Compilers.Common;
using Roslyn.Compilers.CSharp;
using Roslyn.Services;
using Roslyn.Services.CSharp;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Analysis.Test.TestData;

namespace Analysis.Test
{
 
    [TestClass]
    public class ClassDependenciesTest : BaseTest
    {
        [TestMethod]
        public void IsDto_When_Class_With_Only_AutoProp()
        {
            var symbol = GetSymbolForClass(typeof(Dto1));
            var members = symbol.GetMembers();
            var onlyImplicitDeclaredFields = members.Where(m => m.Kind == SymbolKind.Field).All(m => m.IsImplicitlyDeclared);
            var allSetAndGetMethodsHasConstructedFrom = members.Where(m => m.Kind == SymbolKind.Method).All(m => ((MethodSymbol)m).ConstructedFrom != null);

            bool isDto = onlyImplicitDeclaredFields && allSetAndGetMethodsHasConstructedFrom;

            Assert.IsTrue(isDto);
        
        }

    }
}
